Einführung

Title Slide

Normal Slide

  • Adding a website-link: Wikipedia
  • Link to specific chapter on other pages: aes-mapping
  • This will highlight text
  • Fade in

Callout block header

Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod

Columns

Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.

Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et

Columns with code

ggplot(cars, 
       aes(x = speed, y = dist)) +
  geom_point()

Code Annotation

## (Empty line so the copy button doesn't overlays)
ggplot(cars,
       aes(x = speed, y = dist)) +
  geom_point()
1
Input data
2
Define mapping
3
Add layer

Tabs

Wir losen Gruppen aus, jede Gruppe bekommt eine eigene Plot-Art. Erst einmal Einzelarbeit.

ggplot(cars, 
       aes(x = speed, y = dist)) +
  geom_point()

Tabs 2

set.seed(42)
my_weight <- data.frame(
  month = factor(c("Januar", "Februar", "März", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Dezember"),
                 levels = c("Januar", "Februar", "März", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Dezember"), 
                 ordered = TRUE), 
  weight = rnorm(12, 90, 5)/1000, 
  group = rep(1, 12)
)

ggplot(my_weight, 
       aes(x = month, y = weight, group = group)) +
  geom_point() +
  geom_line() +
  labs(title = "Mein Gewicht 2024",
       subtitle = "In metrischen Tonnen", 
       x = "Monat", 
       y = "Gewicht in t") +
  ylim(0, 1000) + 
  theme_bw() +
  theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1))

Bilder

Background image

Foto von Omar Lopez auf Unsplash

Right-side image

I can also put images in a column and fill the right side of the slide with the image by using {.image-right}.

Foto von Fabrice Villard auf Unsplash

gganimate

library(ggplot2)
library(gganimate)

p <- ggplot(mtcars, aes(factor(cyl), mpg)) + 
  geom_boxplot() + 
  # Here comes the gganimate code
  transition_states(
    gear,
    transition_length = 2,
    state_length = 1
  ) +
  enter_fade() + 
  exit_shrink() +
  ease_aes('sine-in-out')
animate(p, renderer = gganimate::gifski_renderer())

plotly

library(plotly)

fig <- plot_ly(midwest, x = ~percollege, color = ~state, type = "box")
fig